package commands;

import java.util.HashMap;
import containers.EmployeeContainer;
import entities.Employee;

;

/**
 * command to add an employee to the EmployeeContainer
 * 
 */
public class AddEmployee {

	/**
	 * adds employee to container
	 * 
	 * @param myEmployee
	 *            Employee to be added to system
	 */
	public AddEmployee(Employee myEmployee) {

		HashMap<Integer, Employee> employees = EmployeeContainer.dictionary();

		if (!employees.containsValue(myEmployee)
				&& !employees.containsKey(myEmployee.getID())) {
			employees.put(myEmployee.getID(), myEmployee);
		}

	}

	/**
	 * checks if employee is added to EmployeeContainer or not
	 * 
	 * @param myEmployee
	 *            Employee to be checked
	 * @return true if in container, false otherwise
	 */
	public boolean isAdded(Employee myEmployee) {

		HashMap<Integer, Employee> employee = EmployeeContainer.dictionary();

		if (employee.containsValue(myEmployee)) {
			return true;
		} else {
			return false;
		}

	}

	/**
	 * checks if employee is added to EmployeeContainer or not
	 * 
	 * @param myEmployeeID
	 *            Employee id to be checked
	 * @return true if in container, false otherwise
	 */
	public boolean isAdded(int myEmployeeID) {

		HashMap<Integer, Employee> employee = EmployeeContainer.dictionary();

		if (employee.containsKey(myEmployeeID)) {
			return true;
		} else {
			return false;
		}

	}
}
